import java.io.*;
import java.net.Socket;


public class GDElevatorInit extends Thread{
	public GroupDispatcher gd;
	
	public GDElevatorInit(GroupDispatcher d){
		gd=d;
	}
	
	public void run() {
		Socket skt = null;
		ElevatorWorker temp = null;
		while(true){ 
			try {
				skt = gd.socket.accept();
				temp = new ElevatorWorker(skt, gd);
			} catch (IOException e) {
				e.printStackTrace();
			}
			gd.numberOfElevators++;
			gd.freeElevators.add(temp);
			(new Thread(temp)).start();
		}
		
	}

}
